/**
 * 
 */
package com.estock.web.service;

import java.util.List;

import com.estock.common.model.security.Stock;

/**
 * @author richard
 *
 */
public interface StockService {
	
	/**
	 * Find all stocks by type
	 * 
	 * @param type
	 * @return
	 */
	public List<Stock> findAllStocksByType(int type, int currentPage, int itemsPerPage); 
	
	/**
	 * find all stocks belong to one category
	 * 
	 * @param stockCategoryId
	 * @return
	 */
	public List<Stock> findStocksByCategoryId(int stockCategoryId);
	
	/**
	 * find the stock with specific code
	 * 
	 * @param code
	 * @return
	 */
	public Stock findStockByCode(String code);
	
	/**
	 * find stock by key
	 * 
	 * @param id
	 * @return
	 */
	public Stock findById(Long id);
	
	/**
	 * save or update a stock entity
	 * 
	 * @param stock
	 */
	public void saveOrUpdate(Stock stock);
	
	/**
	 * get total number of stocks
	 * 
	 * @return
	 */
	public int getStockNumByType(int type) throws Exception;
	
	/**
	 * delete stock by id
	 * 
	 * @return
	 */
	public void deleteStockById(Long id) throws Exception;
	
	
	
	////////Self-Select stock related
	
	
	/**
	 * get total number of my interests
	 * 
	 * @return
	 */
	public int getSelfSelectNum() throws Exception;
	
	
	public List<Stock> findAllSelfSelects(int currentPage, int itemsPerPage) throws Exception;
	
	
	public Stock findSelfSelectByCode(String code) throws Exception;
	
	
	public void saveSelfSelect(Stock entity) throws Exception;
	
	
	public void updateLatestPrice(String code, float latestPrice);
	
	/**
	 * delete self-select stock by id
	 * 
	 * @return
	 */
	public void deleteSelfSelectById(Long id) throws Exception;

	
}
